<template>
    <transition name="fade" mode="out-in">
        <div class="mask" v-if="show">
            <div class="panel">
                <div class="title">{{title}}</div>
                <div class="middleContent">
                    <div class="contentCenter">
                        <i :class="icon" class="icon"></i>
                        <div class="content" v-html="content"></div>
                    </div>
                </div>
                <div class="footer">
                    <el-button type="goon" size="small" @click="ok()">{{confirm}}</el-button>
                    <el-button type="goon" size="small" @click="cover()" v-if="isShowCover">{{coverTxt}}</el-button>
                    <el-button type="goon" size="small" @click="cancel()">{{cancelTxt}}</el-button>
                </div>
            </div>
        </div>
    </transition>
</template>

<script>

export default {
    data(){
        return {

        }
    },
    props: {
        title:String,
        icon:String,
        content:String,
        cancelTxt:String,
        confirm:String,
        show:Boolean,
        isShowCover:Boolean,
        coverTxt:String
    },
    created(){

    },
    methods:{
        open() {
            this.show = true;
        },
        ok(){
            this.show = false;
            this.$emit('confirm')
        },
        cancel(){
            this.show = false;
            this.$emit('cancel');
        },
        cover(){
            this.show = false;
            this.$emit('cover');
        }
    }
}
</script>

<style scoped>
    .fade-enter{
        opacity: 0;
    }
    .fade-enter-active{
        transition: opacity .3s;
    }
    .fade-leave-to{
        opacity: 0;
    }
    .fade-leave-active{
        transition: opacity .3s;
    }
    .mask {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99999;
    }
    .panel{
        width: 100vw;
        position: fixed;
        left: 50%;
        top: 50%;
        transform: translate(-50%,-50%);
        background: rgba(154,137,193, 0.8);
    }
    .title{
        padding: 15px 0px;
        color: #fff;
        font-size: 18px;
        width: 30%;
        margin: auto;
        padding-top: 30px;
    }
    .middleContent{
        position: relative;
        padding: 10px 0;
        width: 30%;
        margin: auto;
    }
    .contentCenter{
        line-height: 24px;
        color: #fff;
        font-size: 16px;
    }
    .contentCenter >>> .tips{
        text-align: left;
    }
    .icon{
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        font-size: 22px;
        color: #f96363;
    }
    .content{
        display: inline-block;
        padding-left: 30px;
    }
    .footer{
        padding: 10px 15px;
        text-align: right;
        width: 30%;
        margin: auto;
    }
</style>
